package cn.huiyunche.base.service.interfaces.impl;

import cn.huiyunche.base.service.interfaces.DWaybillReceiverService;
import cn.huiyunche.base.service.mappers.DWaybillReceiverMapper;
import cn.huiyunche.base.service.model.DWaybillReceiver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @FileName: cn.huiyunche.service.base.tms.interfaces.impl
 * @Description: Description
 * @author: Aaron
 * @date: 2016/11/2 下午3:24
 */
@Service
public class DWaybillReceiverServiceImpl implements DWaybillReceiverService {

    private static final Logger LOGGER = LoggerFactory.getLogger(DWaybillReceiverServiceImpl.class);

    @Autowired
    private DWaybillReceiverMapper dWaybillReceiverMapper;

    @Override
    public Long add(DWaybillReceiver receiver) {
        LOGGER.info("add param : {}", receiver);
        if (null == receiver) {
            LOGGER.error("add param receiver must not be null");
            throw new IllegalArgumentException("运单收货人信息不能为空");
        }

        dWaybillReceiverMapper.insertSelective(receiver);

        return receiver.getId();
    }
}
